#ifndef MATRIXVIEWER_H
#define MATRIXVIEWER_H

#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QGridLayout>
#include <QCloseEvent>

#include "systemcontrol.h"
#include "scrollline.h"
#include "textspinbox.h"


class SystemControl;

class MatrixViewer : public QWidget
{
    Q_OBJECT
public:
    MatrixViewer(QWidget *parent = 0,
                 SystemControl *system = 0/*,
                 QVector<Rule*>* rules = 0*/);
    void init();

    void closeEvent(QCloseEvent *);

public slots:
    void updateRules(); /*add something to determine which rule was changed?*/



private:

    /** Struct designed specifically for this class to allow close monitoring
     * of the output rule's indices and text.
     */
    struct OutputElem {
        QString text;
        int hIndex;
        int vIndex;

        OutputElem() {}
        OutputElem(QString t, int h, int v) :
                text(t),
                hIndex(h),
                vIndex(v)
        {
        }
    };

    void clearAll();

    SystemControl* m_system;

//    QVector<Rule *>* m_rules;
    QVector<QLabel *> m_a_labels;
    QVector<QLabel *> m_b_labels;
    QVector< QVector<TextSpinBox *> > m_outputs;
    QGridLayout* m_layout;
//	QList<QString> m_o_names;
};

#endif // MATRIXVIEWER_H
